<me:UIWBDAT x:Class="WPFExcelReport.TPWB02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                    xmlns:WS="clr-namespace:WPFExcelReport;assembly=TWASTAMM" 
                    xmlns:WF="clr-namespace:WPFExcelReport;assembly=TWAFARBEN" 
                    xmlns:WH="clr-namespace:WPFExcelReport;assembly=TLAGPL"  
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIWBDAT.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>  
    </me:UIWBDAT.Resources>
    <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0">
                <WrapPanel> 
                <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" VerticalAlignment="Top"
                             >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                    <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=年}}"/>
                        <ex:TXT72 MaxLength="4" Grid.Column="1"  Text="{Binding YYYY}"   Width="60" />
                    </Grid>
                    <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=月}}"></TextBlock>
                        <ex:TXT72 MaxLength="2" Grid.Column="1"  Text="{Binding MM}"   Width="30" />
                    </Grid>
                    <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=日}}"></TextBlock>
                        <ex:TXT72 MaxLength="2" Grid.Column="1"  Text="{Binding DD}"  Width="30" />
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>

                        </Grid.ColumnDefinitions>
                        <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=库位:}}"></TextBlock>
                        <CheckBox  Grid.Column="1" Name="cWH"></CheckBox>
                        <WrapPanel  Grid.Column="2" >
                            <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding LO, ElementName=TV}" Width="40"/>
                            <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding LB, ElementName=TV}" Width="60"/>
                            <ex:TXT72  MaxLength="8" CharacterCasing="Upper"  Text="{Binding LP, ElementName=TV}" Width="60"/>
                            <WH:TSWH  KEY="{Binding WH,ElementName=TV}"
                                      Visibility="{Binding IsChecked,ElementName=cWH,Converter={StaticResource bv}}"/>
                        </WrapPanel>
                    </Grid>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=描述:}}"></TextBlock>
                        <ex:TXT72 MaxLength="20"  Grid.Row="1"  Text="{Binding DES,Converter={StaticResource gb2312} }" Width="80" />
                    </Grid>
                    <WF:TSWS07 Grid.Column="1" ART="{Binding ART,ElementName=TV}" 
                           VAR="{Binding VAR,ElementName=TV}" 
                           FARBE="{Binding FARBE,ElementName=TV}"  
                           MinWidth="150" />
                </WrapPanel>
            </StackPanel>
            <Grid Grid.Row="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel>
                    <WrapPanel Visibility="{Binding IsCanChg,ElementName=TV,Converter={StaticResource ResourceKey=bv}}">
                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                        <Grid Margin="10,0,0,0" Visibility="{Binding IsCanDelete,ElementName=TV,Converter={StaticResource ResourceKey=bv}}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24">
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                                </Button.Background>
                            </Button>
                        <TextBlock Grid.Column="1" Text="{Binding Source={Localization:Translate Word=删除整个批次}}" />
                    </Grid>
                        <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource ResourceKey=bv}}">
                            <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <ex:TXT72 MaxLength="10" Text="{Binding WBKDPART,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}" Width="100" />
                        </Grid>
                    </WrapPanel>
                </StackPanel>
                <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"   
                   RowDetailsVisibilityMode="Visible"  Margin="0,0,0,0"
                    >
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Path=WBRWKRS}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBRWLFD}" Header="{Binding Source={Localization:Translate Word=入库批次}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBLESTKNR}" Header="{Binding Source={Localization:Translate Word=布卷号}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBWAKZ}" Header="{Binding Source={Localization:Translate Word=类型}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBART}" Header="{Binding Source={Localization:Translate Word=面料}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBFARBE}" Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBEINDAT}" Header="{Binding Source={Localization:Translate Word=入库日期}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBEINLO}" Header="{Binding Source={Localization:Translate Word=库}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBKDPART}" Header="{Binding Source={Localization:Translate Word=客户批次}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBSTK}" Header="{Binding Source={Localization:Translate Word=布卷数}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBMTR,Converter={StaticResource d100}}" Header="{Binding Source={Localization:Translate Word=入库MTR}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBBRT,Converter={StaticResource d10}}" Header="{Binding Source={Localization:Translate Word=幅宽}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBGRQM}" Header="{Binding Source={Localization:Translate Word=克重}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBGRLFD}" Header="{Binding Source={Localization:Translate Word=克重}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBFDDIK}" Header="{Binding Source={Localization:Translate Word=经密}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBFDDIS}" Header="{Binding Source={Localization:Translate Word=纬密}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBNEUBEN}" Header="{Binding Source={Localization:Translate Word=入库}}"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=WBNEUDAT}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                    </DataGrid.Columns>
                </DataGrid  >

            </Grid>

        </Grid> 
</me:UIWBDAT>
